<?php

namespace Biz\Mailers\Site;

use Biz\Mailers\User\Tags\UserTags;
use Biz\Mailers\App\Tags\AppSiteTags;
use Biz\Models\Site\SitePaperAbstract;
use Biz\Mailers\Site\Tags\SitePaperTags;
use Biz\Mailers\User\Tags\UserMemberTags;
use Biz\Constants\Site\SiteEmailConstants;
use Biz\Mailers\Site\Tags\SitePaperAbstractTags;

class SitePaperAbstractPassedMail extends SiteMailer
{
    /**
     * The subject of the message.
     *
     * @var string
     */
    public $subject = 'Paper Abstract Passed';

    /**
     * The view to use for the message.
     *
     * @var string
     */
    public $view = 'emails.default.site.paper.abstract.passed';

    /**
     * Email Type.
     *
     * @var string
     */
    protected $emailType = SiteEmailConstants::TYPE_ABSTRACT_PASSED;

    /**
     * UserMemberRegisterMail constructor.
     *
     * @param SitePaperAbstract $abstract
     */
    public function __construct(SitePaperAbstract $abstract)
    {
        // Before
        parent::__construct();

        $paper      = $abstract->paper;
        $user       = $paper->user;
        $this->to($user->email, $user->nickname);

        $userMember = $user->member;

        $this->pushTags(new AppSiteTags($this->getAppSite()))
            ->pushTags(new UserTags($user))
            ->pushTags(new UserMemberTags($userMember))
            ->pushTags(new SitePaperTags($paper))
            ->pushTags(new SitePaperAbstractTags($abstract));
    }
}
